*************************************************************************************************
**Violence in the Eye of the Beholder: Does Identity Shape Civilians’ Perceptions towards Peacekeepers?
*************************************************************************************************




*************************************************
**************Data Management********************
*************************************************

*Stata Version 15.1 


*Import data 

use "UN_data1.dta", clear

*************************************************
**Creating the treatent groups

*Treatment 1 Group Dummy 1 
 
gen UN1_treatment=1 if Group==1

replace UN1_treatment=0 if Group==2

replace UN1_treatment=0 if Group==3

replace UN1_treatment=0 if Group==4

replace UN1_treatment=0 if Group==5


*Treatment 2 Group Dummy 2 

gen UN2_treatment=1 if Group==2

replace UN2_treatment=0 if Group==1

replace UN2_treatment=0 if Group==3

replace UN2_treatment=0 if Group==4

replace UN2_treatment=0 if Group==5



*Treatment 3 Group Dummy 3 

gen UN3_treatment=1 if Group==3

replace UN3_treatment=0 if Group==1

replace UN3_treatment=0 if Group==2

replace UN3_treatment=0 if Group==4

replace UN3_treatment=0 if Group==5


*Treatment 4 Group Dummy 4 

gen UN4_treatment=1 if Group==4

replace UN4_treatment=0 if Group==1

replace UN4_treatment=0 if Group==2

replace UN4_treatment=0 if Group==3

replace UN4_treatment=0 if Group==5


*Treatment 5 Group Dummy 5 


gen UN5_treatment=1 if Group==5

replace UN5_treatment=0 if Group==1

replace UN5_treatment=0 if Group==2

replace UN5_treatment=0 if Group==3

replace UN5_treatment=0 if Group==4


**************************************************************************
**Creating the social dominance index - simple additive index 

gen socialdominance_index = s_dominance1+s_dominance2+s_dominance3 

recode socialdominance_index(3=1) (4=2) (5=3) (6=4) (7=5) (8=6) (9=7) (10=8) (11=9) (12=10) (13=11) (14=12) (15=13) (16=14) (17=15) (18=16) (19=17) (20=18), gen(socialdominance)

drop socialdominance_index

rename socialdominance socialdominance_index

gen norm_socialdominance_index = (socialdominance_index -1)/(18-1)




****Creating the Security index - simple additive index 

*Due to the small number of NA we convert them to ones (1). 
*a non-response we assume it is more close to Yes. 

recode kidnaping (1=3), gen(new_kidnaping)

recode new_kidnaping (2=1) (3=2), gen(kidnaping_n)

recode bodilyharm (1=3), gen(new_bodilyharm)

recode new_bodilyharm (2=1) (3=2), gen(bodilyharm_n)

recode murder (1=3), gen(new_murder)

recode new_murder (2=1) (3=2), gen(murder_n)

recode familysafe (1=1) (2=0) (3=0) (4=1) (5=1) (6=1), gen(n_familysafe)

gen security = looting + kidnaping_n + bodilyharm_n + murder_n + n_familysafe

recode security (4=1) (5=2) (6=3) (7=4) (8=5) (9=6), gen(security_index) 

gen norm_security_index = (security_index - 1)/(6-1) 





*Creating four dummy variable to be used in the subset analysis 
**Defensive Violence Control variable Group Defense  

gen binary_defensev=0 if dv_groupdefense==1

replace binary_defensev=0 if dv_groupdefense==2

replace binary_defensev=0 if dv_groupdefense==3

replace binary_defensev=0 if dv_groupdefense==4

replace binary_defensev=0 if dv_groupdefense==5

replace binary_defensev=. if dv_groupdefense==6

replace binary_defensev=1 if dv_groupdefense==7

replace binary_defensev=1 if dv_groupdefense==8

replace binary_defensev=1 if dv_groupdefense==9

replace binary_defensev=1 if dv_groupdefense==10

replace binary_defensev=1 if dv_groupdefense==11





**Defensive Violence Control variable Exessive violence  

gen binary_violence=0 if dv_exessiveviolence==1

replace binary_violence=0 if dv_exessiveviolence==2

replace binary_violence=0 if dv_exessiveviolence==3

replace binary_violence=0 if dv_exessiveviolence==4

replace binary_violence=0 if dv_exessiveviolence==5

replace binary_violence=. if dv_exessiveviolence==6

replace binary_violence=1 if dv_exessiveviolence==7

replace binary_violence=1 if dv_exessiveviolence==8

replace binary_violence=1 if dv_exessiveviolence==9

replace binary_violence=1 if dv_exessiveviolence==10

replace binary_violence=1 if dv_exessiveviolence==11




**Binary Defensive Violence Control Variable  

gen binary_morality=0 if dv_morality==1

replace binary_morality=0 if dv_morality==2

replace binary_morality=0 if dv_morality==3

replace binary_morality=0 if dv_morality==4

replace binary_morality=0 if dv_morality==5

replace binary_morality=. if dv_morality==6

replace binary_morality=1 if dv_morality==7

replace binary_morality=1 if dv_morality==8

replace binary_morality=1 if dv_morality==9

replace binary_morality=1 if dv_morality==10

replace binary_morality=1 if dv_morality==11



**Binary Excessive Violence Control Variable  

gen binary_exessuve=0 if dv_exessiveviolence==1

replace binary_exessuve=0 if dv_exessiveviolence==2

replace binary_exessuve=0 if dv_exessiveviolence==3

replace binary_exessuve=0 if dv_exessiveviolence==4

replace binary_exessuve=0 if dv_exessiveviolence==5

replace binary_exessuve=. if dv_exessiveviolence==6

replace binary_exessuve=1 if dv_exessiveviolence==7

replace binary_exessuve=1 if dv_exessiveviolence==8

replace binary_exessuve=1 if dv_exessiveviolence==9

replace binary_exessuve=1 if dv_exessiveviolence==10

replace binary_exessuve =1 if dv_exessiveviolence==11





*Defense Group Treatment 1 

gen defense_group1=0 if binary_defensev==0 & Group==1

replace defense_group1=1 if binary_defensev==1 & Group==1


*Defense Group Treatment 2 

gen defense_group2=0 if binary_defensev==0 & Group==2

replace defense_group2=1 if binary_defensev==1 & Group==2


*Defense Group Treatment 3 

gen defense_group3=0 if binary_defensev==0 & Group==3

replace defense_group3=1 if binary_defensev==1 & Group==3


*Defense Group Treatment 4 

gen defense_group4=0 if binary_defensev==0 & Group==4

replace defense_group4=1 if binary_defensev==1 & Group==4


*Defense Group Treatment 5 

gen defense_group5=0 if binary_defensev==0 & Group==5

replace defense_group5=1 if binary_defensev==1 & Group==5






*Exessive Violence Treatment 1

gen escessive_group1=0 if binary_exessive==0 & Group==1

replace escessive_group1=1 if binary_exessive==1 & Group==1


*Excessive Violence Treatment 2 

gen escessive_group2=0 if binary_exessive==0 & Group==2

replace escessive_group2=1 if binary_exessive==1 & Group==2


*Excessive Violence - Attribution Treatment 3 

gen escessive_group3=0 if binary_exessive==0 & Group==3

replace escessive_group3=1 if binary_exessive==1 & Group==3



*Excessive Violence - Attribution Treament 4 

gen escessive_group4=0 if binary_exessive==0 & Group==4

replace escessive_group4=1 if binary_exessive==1 & Group==4



*Excessive Violence - Attribution Treament 5 

gen escessive_group5=0 if binary_exessive==0 & Group==5

replace escessive_group5=1 if binary_exessive==1 & Group==5





*Morality Treatment 1

gen morality_group1=0 if binary_morality==0 & Group==1

replace morality_group1=1 if binary_morality==1 & Group==1


*Morality Treatment 2 

gen morality_group2=0 if binary_morality==0 & Group==2

replace morality_group2=1 if binary_morality==1 & Group==2


*Morality Treatment 3 

gen morality_group3=0 if binary_morality==0 & Group==3

replace morality_group3=1 if binary_morality==1 & Group==3


*Morality Treament 4 

gen morality_group4=0 if binary_morality==0 & Group==4

replace morality_group4=1 if binary_morality==1 & Group==4



*Morality Treament 5 

gen morality_group5=0 if binary_morality==0 & Group==5

replace morality_group5=1 if binary_morality==1 & Group==5






